<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <style type="text/css">
			div{ 
				width:100px;
				height:100px;
				background-color:#abcdef;
				margin-top:10px;
				display:none;
			}
        </style>
        <script type="text/javascript">
        	window.onload = function(){
        		var anniu = document.getElementsByTagName("button");
        		var divs = document.getElementsByTagName("div");
        		/*alert(anniu.length)*/
        		
        	}
        </script>
    </head>
    <body>
    	<button>1</button>
    	<button>2</button>
    	<button>3</button>
    	<button>4</button>
    	<div id="div1">1</div>
    	<div id="div2">2</div>
    	<div id="div3">3</div>
    	<div id="div4">4</div>
    </body>
</html>